package com.baby.springboot.consumer;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class TopicConsumer {


    @RabbitListener(bindings = {
            @QueueBinding(value = @Queue,
            exchange = @Exchange(value = "amq.topic",
            type = "topic"),
            key = "#")
    })
    public void consumer1(String massage){
        System.out.println("一号："+ massage);
    }

    @RabbitListener(bindings = {@QueueBinding(value = @Queue,
    exchange =@Exchange(value = "amq.topic",
    type = "topic"),
    key = "*.error")
    })
    public void consumer2(String message){
        System.out.println("二号:"+message);
    }


}
